package com.sym.demo.poi.test;

/**
 * @author suyongming
 * @date ：2021/1/13 20:13
 */
public class Demo {
    private static boolean initFlag = false;
    public static void main(String[] args) throws InterruptedException {
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("等待公交车>>>>>>>>>>>>>>");
                while (!initFlag) {

                }
                System.out.println("我上车了");
            }
        }).start();


        Thread.sleep(2000);

        new Thread(()-> {
            changeFlag();
        }).start();
    }



    private static void changeFlag(){
        System.out.println("init start>>>>>>>>>>>>>>>>>>>>");
        initFlag = true;
        System.out.println("init end>>>>>>>>>>>>>>>>>>>>");
    }
}
